package chapter8;

import java.util.Arrays;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2019-03-20 下午5:21
 */
class A {

}

class B extends A {

}

class C {

}

public class OverrideTest {
    public static void main(String[] args) {
        OverrideTest test = new OverrideTest();
        test.test(Arrays.asList(new A[]{new A()}));
        test.test(Arrays.asList(new B[]{new B()}));
//        test.test(Arrays.asList(new C[]{new C()}));
    }

    // 编译不通过
    /*public void test(List<? extends B> param){
        System.out.println("? extends B");
    }*/

    /*public void test(List<? extends C> param){
        System.out.println("? extends C");
    }*/

    public void test(List<? extends A> param) {
        System.out.println("? extends A");
    }
}
